var RandomUtils = require('./RandomUtil');
var moment = require('moment');
var variables = require('../../config/variables');

module.exports = {
  genSaltValue: function() {
    // 生成随机的盐值
    return RandomUtils.genRandomChars(variables.saltValueLength);
  },
  genUserId: function() {
    // 生成user id
    var rand = RandomUtils.genRandomNumbers(variables.userIdRandNumLength);
    var datetime = moment(new Date()).format('YYYYMMDDHHmmss');
    return datetime + rand;
  },
  genAttachmentId: function() {
    // 生成附件id
    var rand = RandomUtils.genRandomNumbers(variables.attachmentIdRandNumLength);
    var datetime = moment(new Date()).format('YYYYMMDDHHmmss');
    return datetime + rand;
  },
  genProjectNo: function() {
    // 生成项目编号
    var rand = RandomUtils.genRandomNumbers(variables.attachmentIdRandNumLength);
    var datetime = moment(new Date()).format('YYYYMMDDHHmmss');
    return datetime + rand;
  },
  genMessageNo: function() {
    // 生成消息编号
    var rand = RandomUtils.genRandomChars(variables.messageRandNumLength);
    var datetime = moment(new Date()).format('YYYYMMDDHHmmssSSS');
    return datetime + rand;
  }
}
